import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import 'element-plus/dist/index.css'
import PiniaPluginPersistedstate from 'pinia-plugin-persistedstate'
// 引入自定义插件对象，注册成全局组件
import gloalComponents from '@/components'
// svg
import 'virtual:svg-icons-register'
// Element国际化
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// 导入路由守卫
import './guardian'
import { useMenuStore } from './stores/menu'
const pinia = createPinia()
pinia.use(PiniaPluginPersistedstate)
const app = createApp(App)

app.use(gloalComponents)

app.use(ElementPlus, {
  locale: zhCn
})

app.use(pinia)
const menuRouter = useMenuStore()
await menuRouter.setRouter()

app.use(router)

app.mount('#app')
